//
//  ATNetworksLogicalTest.m
//  ATNetworks
//
//  Created by Ankit Thakur on 10/05/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ATNetworksLogicalTest.h"
#import "ATJSONDispatcher.h"
#import "ATNetworksAppDelegate.h"
@implementation ATNetworksLogicalTest

#if USE_APPLICATION_UNIT_TEST     // all code under test is in the iPhone Application

- (void) testAppDelegate {
    
    ATNetworksAppDelegate *yourApplicationDelegate = (ATNetworksAppDelegate*)[[UIApplication sharedApplication] delegate];
    STAssertNotNil(yourApplicationDelegate, @"UIApplication failed to find the AppDelegate");
    
}

- (void) testJSon{
	
	NSString *jsonString =[NSString stringWithFormat:@"{\"menu\": { \"header\": \"SVG Viewer\",  \"items\": [{\"id\": \"Open\"},{\"id\": \"OpenNew\", \"label\": \"Open New\"},null,{\"id\": \"ZoomIn\", \"label\": \"Zoom In\"},{\"id\": \"ZoomOut\", \"label\": \"Zoom Out\"},{\"id\": \"OriginalView\", \"label\": \"Original View\"},null,{\"id\": \"Quality\"},{\"id\": \"Pause\"},{\"id\": \"Mute\"},null,{\"id\": \"Find\", \"label\": \"Find...\"},{\"id\": \"FindAgain\", \"label\": \"Find Again\"},{\"id\": \"Copy\"},{\"id\": \"CopyAgain\", \"label\": \"Copy Again\"},{\"id\": \"CopySVG\", \"label\": \"Copy SVG\"},{\"id\": \"ViewSVG\", \"label\": \"View SVG\"},{\"id\": \"ViewSource\", \"label\": \"View Source\"}{\"id\": \"SaveAs\", \"label\": \"Save As\"},null,{\"id\": \"Help\"},{\"id\": \"About\", \"label\": \"About Adobe CVG Viewer...\"}]}}"];
	
	ATJSONDispatcher *jsonDispatcher = [[ATJSONDispatcher alloc] init];
	NSData* data=[jsonString dataUsingEncoding:NSUTF8StringEncoding];
	id testData = [jsonDispatcher encodeJSONData:data];
	STAssertNotNil(testData, @"JSOn data is not nil");
	
}

#else                           // all code under test must be linked into the Unit Test bundle

- (void) testMath {
    
    STAssertTrue((1+1)==2, @"Compiler isn't feeling well today :-(" );
    
}


#endif


@end
